﻿Public Class tweets

    Private Sub feedURL_GotFocus(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles feedURL.GotFocus
        If feedURL.Text = "Type Feed URL here" Then
            feedURL.Text = ""
        End If
    End Sub

    Private Sub feedURL_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Input.KeyEventArgs) Handles feedURL.KeyDown
        If e.Key = Key.Enter Then
            AddFeed()
        End If
    End Sub
    Private Sub AddFeed()
        Dim f As XElement = XElement.Load(feedURL.Text)
        Dim tweets = From i In f.Descendants("item") _
                     Select i

        For Each t As XElement In tweets
            Dim tb As New TextBlock()
            tb.Text = t.<description>.First.Value
            sP.Children.Insert(1, tb)
        Next
    End Sub

    Private Sub feedURL_LostFocus(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles feedURL.LostFocus
        If feedURL.Text = "" Then
            feedURL.Text = "Type Feed URL here"
        End If
    End Sub
End Class
